import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '@/views/layout/index'

Vue.use(VueRouter)

export  const asyncRouterMap = [
  {
    path:'/',
    name:'index',
    component:()=> import('@/pages/index'),
    meta: {title: '官网'}
  },
   {
    path: '/enterPriseGudance',
    component: Layout,
    redirect: '/index',
    name: 'enterPriseGudance',
    meta: { title: '新手指导' , power: [0],requireAuth:true},
    children: [
      {
        path: 'gudance',
        name: 'gudance',
        component: () => import('@/pages/enterprise/guidance'),
        meta: { title: '新手指导' },
      }
    ]
  },
  {
    path: '/enterPriseSign',
    component: Layout,
    redirect: '/index',
    name: 'enterPriseSign',
    meta: { title: '签约指导' , power: [0],requireAuth:true},
    children: [
      {
        path: 'goSign',
        name: 'goSign',
        component: () => import('@/pages/enterprise/sign/goSign'),
        meta: { title: '如何与服务商签约' },
      },
      {
        path: 'law',
        name: 'law',
        component: () => import('@/pages/enterprise/sign/law'),
        meta: { title: '垫资签约是否有法律效应' },
      },
      {
        path: 'auditStatus',
        name: 'auditStatus',
        component: () => import('@/pages/enterprise/sign/auditStatus'),
        meta: { title: '如何查看签约申请的审核状态' },
      },
      {
        path: 'undoSignn',
        name: 'undoSignn',
        component: () => import('@/pages/enterprise/sign/undoSignn'),
        meta: { title: '已申请的签约如何撤销' },
      },
    ]
  },
  {
    path: '/enterPriseProject',
    component: Layout,
    redirect: '/index',
    name: 'enterPriseProject',
    meta: { title: '项目指导' , power: [0],requireAuth:true},
    children: [
      {
        path: 'addProject',
        name: 'addProject',
        component: () => import('@/pages/enterprise/project/addProject'),
        meta: { title: '如何发布项目' },
      },
      {
        path: 'undoAddProject',
        name: 'undoAddProject',
        component: () => import('@/pages/enterprise/project/undoAddProject'),
        meta: { title: '已发布的项目可以取消吗' },
      },
      {
        path: 'undertakeProject',
        name: 'undertakeProject',
        component: () => import('@/pages/enterprise/project/undertakeProject'),
        meta: { title: '那些服务商可以承接项目' },
      },
      {
        path: 'viewServiceProvider',
        name: 'viewServiceProvider',
        component: () => import('@/pages/enterprise/project/viewServiceProvider'),
        meta: { title: '如何查看申请承接的服务商' },
      },
      {
        path: 'viewServiceMember',
        name: 'viewServiceMember',
        component: () => import('@/pages/enterprise/project/viewServiceMember'),
        meta: { title: '如何引导员工与服务商签约' },
      },
    ]
  },
  {
    path: '/enterPriseSettlement',
    component: Layout,
    redirect: '/index',
    name: 'enterPriseSettlement',
    meta: { title: '验收结算指导' , power: [0],requireAuth:true},
    children: [
      {
        path: 'applySettlement',
        name: 'applySettlement',
        component: () => import('@/pages/enterprise/settlement/applySettlement'),
        meta: { title: '如何申请验收结算' },
      },
      {
        path: 'applySettlementFailure',
        name: 'applySettlementFailure',
        component: () => import('@/pages/enterprise/settlement/applySettlementFailure'),
        meta: { title: '审核失败如何处理' },
      },
      {
        path: 'settlementPayFailure',
        name: 'settlementPayFailure',
        component: () => import('@/pages/enterprise/settlement/settlementPayFailure'),
        meta: { title: '支付失败的原因' },
      },
    ]
  },
  {
    path: '/enterPriseInvoice',
    component: Layout,
    redirect: '/index',
    name: 'enterPriseInvoice',
    meta: { title: '发票指导' , power: [0],requireAuth:true},
    children: [
      {
        path: 'undoInvoice',
        name: 'undoInvoice',
        component: () => import('@/pages/enterprise/invoice/undoInvoice'),
        meta: { title: '已申请的发票如何撤销' },
      },
    ]
  },
  {
    path: '/providerGudance',
    component: Layout,
    redirect: '/index',
    name: 'providerGudance',
    meta: { title: '新手指导' , power: [1],requireAuth:true},
    children: [
      {
        path: 'gudance',
        name: 'gudance',
        component: () => import('@/pages/provider/guidance'),
        meta: { title: '新手指导' },
      },
    ]
  },
  {
    path: '/providerSign',
    component: Layout,
    redirect: '/index',
    name: 'providerSign',
    meta: { title: '签约指导' , power: [1],requireAuth:true},
    children: [
      {
        path: 'applyEnterPriseSign',
        name: 'applyEnterPriseSign',
        component: () => import('@/pages/provider/sign/applyEnterPriseSign'),
        meta: { title: '如何与企业方签约' },
      },
      {
        path: 'law',
        name: 'law',
        component: () => import('@/pages/enterprise/sign/law'),
        meta: { title: '垫资签约是否有法律效应' },
      },
      {
        path: 'writtenContract',
        name: 'writtenContract',
        component: () => import('@/pages/provider/sign/writtenContract'),
        meta: { title: '线下签约合同如何上传到平台' },
      },
      {
        path: 'contractExpires',
        name: 'contractExpires',
        component: () => import('@/pages/provider/sign/contractExpires'),
        meta: { title: '合同到期如何处理' },
      },
    ]
  },
  {
    path: '/providerProject',
    component: Layout,
    redirect: '/index',
    name: 'providerProject',
    meta: { title: '项目指导' , power: [1],requireAuth:true},
    children: [
      {
        path: 'applyProject',
        name: 'applyProject',
        component: () => import('@/pages/provider/project/applyProject'),
        meta: { title: '如何承接项目' },
      },
      {
        path: 'undoApplyProject',
        name: 'undoApplyProject',
        component: () => import('@/pages/provider/project/undoApplyProject'),
        meta: { title: '如何撤销项目承接申请' },
      },
    ]
  },
  {
    path: '/providerOther',
    component: Layout,
    redirect: '/index',
    name: 'providerOther',
    meta: { title: '其他问题' , power: [1],requireAuth:true},
    children: [
      {
        path: 'memberSignStatus',
        name: 'memberSignStatus',
        component: () => import('@/pages/provider/other/memberSignStatus'),
        meta: { title: '如何查看项目员工签约状态' },
      },
      {
        path: 'projectSettlementStatus',
        name: 'projectSettlementStatus',
        component: () => import('@/pages/provider/other/projectSettlementStatus'),
        meta: { title: '如何查看项目验收结算状态' },
      },
      {
        path: 'settleCommission',
        name: 'settleCommission',
        component: () => import('@/pages/provider/other/settleCommission'),
        meta: { title: '如何向平台结算佣金' },
      },
    ]
  },
]

export const constantRouterMap = [
  
]

const router = new VueRouter({
  mode: 'history', // 去掉链接后面的# 需要配合nginx 配置
  routes: asyncRouterMap
})

export default router
